package jun.empdepmanagersystem02.pojo;


import lombok.AllArgsConstructor;
import lombok.Data;

@Data
@AllArgsConstructor
public class Result {
    private Integer code;
    private String msg;
    private Object data;


    //增删改 返回成功即可
    public static Result success() {
        return new Result(1, "success", null);
    }

    //查 返回成功和数据
    public static Result success(String msg, Object data) {
        return new Result(1, msg, data);
    }

    public static Result success(Object data) {
        return success("success", data);
    }

    public static Result error() {
        return new Result(0, "error", null);
    }

    public static Result error(String msg) {
        return new Result(0, msg, null);
    }

}


